﻿@model PagedList<RBS.Core.Model.U_Friends>
@using Webdiyer.WebControls.Mvc
@{
    ViewBag.Title = "我的粉丝";
    Layout = "~/Views/Shared/_UserLayout.cshtml"; 
}
<script>
    $(function () {
        $("#btnguanzhu").click(function () {
            var f_str = "";
            $(".ltable :checkbox[id='chkId']").each(function () {
                if (this.checked && this.value != "undefined") {
                    f_str += this.value + ',';
                }
            });
            addfans(f_str);
            return false;
        });

    });
    

    function addfans(ids) {
        var url = '@Url.Action("Guanzhu")?ids=' + ids;
        $.ajax({
            url: url,
            type: "post",
            dataType: 'json',
            success: function (data) {
                if (data.IsSuccess) {
                    $.dialog.alert(data.Msg);
                    loadPage(data.Data);
                }
                else {

                    $.dialog.alert(data.Msg);
                }
            }
        });
    }
</script>


<!--导航栏-->
<div class="content-tab-wrap">
    <div id="floatHead" class="content-tab">
        <div class="content-tab-ul-wrap">
            <ul>
                <li><a href="@Url.Action("Friends")"  >我的好友</a></li>
                 <li><a href="@Url.Action("Fans")"  class="selected">新加好友</a></li>
            </ul>
        </div>
    </div>
</div>
<!--/导航栏-->
<!--工具栏-->
<div class="toolbar-wrap">
    <div id="floatHead" class="toolbar">
        <div class="l-list">
            <ul class="icon-list"> 
                <li><a class="all" href="javascript:;" onclick="checkAll(this);"><i></i><span>全选</span></a></li>
                <li>
                    <a id="btnguanzhu" class="del" href="#"><i></i><span>关注</span></a>
                </li>
            </ul>
        </div>
     
    </div>
</div>
<!--/工具栏-->
<div class="tbllist">
<!--列表-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
    <tr>
        <th width="8%">选择</th> 
        <th align="left">粉丝姓名</th>
          <th align="left">粉丝手机</th>
        <th align="left">状态</th>
        <th>操作</th>
        
    </tr>
    @if (null != ViewData.Model)
    {
        foreach (var item in ViewData.Model)
        {
            var user = new RBS.Core.BLL.U_User().GetModelByCache(item.UserId);
            var bbb = new RBS.Core.BLL.U_Friends().ExistsFriendId(item.UserId, item.FriendId);
            <tr>
                <td align="center">
                     @if (bbb == false)
                     {
                    <input type="checkbox" id="chkId" value="@user.Id" class="checkall" style="vertical-align: middle;" />
                         <input id="hidId" type="hidden" value="@user.Id"/>
                     }
                </td> 
                <td align="left">
                   @(user.U_Name)
                </td> 
                 <td align="left">
                     @(user.Mobile)
                </td> 
                <td align="left">
                @( bbb == false ? "未关注" : "已关注")
                </td>
                <td  align="center">
                 @if (bbb == false)
                     {
                      <a href="javascript:;" onclick="addfans(@user.Id)">接受</a>
                     }
                  
                </td>
            </tr>
        }
    }
</table>
     </div>
<!--/列表-->
<!--内容底部-->
 
<div class="pagelist">
    <div class="l-btns">
        <span>显示</span> <span>10 条/页</span><span>共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录，当前为第 @Model.CurrentPageIndex 页</span>
    </div>
    @Html.Pager(Model, new PagerOptions { PageIndexParameterName = "id", ShowPageIndexBox = true, PageIndexBoxType = PageIndexBoxType.DropDownList, ShowGoButton = false, CurrentPagerItemWrapperFormatString = "<span class=\"current\">{0}</span>" }, new { id = "PageContent", @class = "default" })
    @section Scripts{@{Html.RegisterMvcPagerScriptResource();}}
</div>
<!--/内容底部-->


